package com.SH.service.impl;

import com.SH.mapper.GoodsMapper;
import com.SH.pojo.Goods;
import com.SH.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:
 * @Project:
 * @CreateDate: Created in 2020/3/4 19:46
 * @Author: YXH
 */
@Service
public class GoodServiceImpl implements GoodsService {

    @Autowired
    GoodsMapper goodsMapper;

    @Override
    public void addGoods(Goods goods) {
        goodsMapper.addGood(goods);
    }

    @Override
    public List<Goods> getCidGoods(int cid) {
       List<Goods> list = goodsMapper.getCidGoods(cid);
        return list;
    }

    @Override
    public List<Goods> findGoods(String name) {
        List<Goods> list = goodsMapper.findGoods(name);
        return list;
    }

    @Override
    public void delGoods(Integer id) {
        goodsMapper.delGood(id);
    }

    @Override
    public List<Goods> sellingGoods(int uid) {
        List<Goods> list = goodsMapper.sellingGoods(uid);
        return list;
    }

    @Override
    public Goods getById(int id) {
        return goodsMapper.getById(id);
    }

    @Override
    public void cancelGood(Goods goods) {
        goodsMapper.cancelGood(goods);
    }

    @Override
    public void update(Goods goods) {
        goodsMapper.updateGoods(goods);
    }

    @Override
    public List<Goods> getAllGood() {
        List<Goods> goods = goodsMapper.getAllGood();
        return goods;
    }
}
